Creating Your First Macromedia Central Application
Phillip Kerman
Macromedia Central offers a real opportunity for developers and a great experience for users. Even the first generation of Central applications are pretty handy. There's a lot to like in Central. For me, the fact that it's all just ActionScript means I can start making Central applications after only a modest learning curve.
This article gets your hands dirty building your first Central application. It won't be particularly pretty but with the skeleton you build here you'll be able to flex your Flash muscles to turn it into something really great. Just wait and see.
Requirements
To complete this tutorial you will need to install the following software and files:
Macromedia Central
Macromedia Central SDK
Macromedia Flash MX 2004
Download sample files for this tutorial
myfirstcentral.zip (1.1
MB)
Structure and Terms Before Getting Started
Your Central product can include an application that appears in the main shell plus smaller Flash applications, called pods, that appear in the Console. Additionally, if you want to run background tasks while your application is dormant, you need an agent. Each piece of your product (application, pod, and agent) uses a separate SWF, which your users install in one click using the installer.swf file posted on your website or through Central's built-in Application Finder. In either case, you need a product.xml file, which specifies which files get installed as well as other details, such as where help files are located, the cost of your application, and the duration of any trial period, where appropriate.
Dealing with all these files really isn't so bad. For example, you can use the generic installer.swf that ships with the Central SDK as is. It automatically reads and parses product.xml. Here are the files you'll build in this tutorial (see Figure 1):
- product.xml: Includes details needed for Central to install your files
- installer.swf: Generic installer that parses data in product.xml
- app.swf, app.fla, app.as: SWF and source files (.fla and .as) for the main shell application
- pod.swf, pod.fla, pod.as: SWF and source files for the pod application
- agent.swf, agent.fla, agent.as: SWF and source files for the agent application
- interface.as: Provides a list of shared methods (through LCService) for all three applications
Note: For more information about LCService, read Ethan Malasky's article, "Understanding and Using the LCService Library."
Figure 1. Files necessary for creating your first Macromedia Central application
You must install Central applications from an actual web server. This way, the Flash Player security restrictions will be based on the server from which you installed the Central application. For testing, you can use localhost (http://127.0.0.1). Alternatively, upload files to a website you control and install the application from there. In addition, be sure to use the Macromedia Central Product ID Registration generator so you get a unique number that ensures all your products (even tests) install properly. When you are ready to publish your application and intend to sell it, look into the requirements so you can get it listed in the Application Finder. This way your potential customers will have an easy way of finding your application. Don't worry about that for this tutorial, however, because you're just making a simple application.
Creating a Simple Central Application
To make the "simplest Central app in history" you create a FLA (app.fla) that turns into app.swf. Install the application using a generic version of installer.swf and product.xml, which basically says "install the app.swf file." For modularity purposes, app.fla includes your code inside app.as. Once you have this application running inside Central you can easily add more features.
Here are the steps:
- To make app.fla, open Macromedia Flash MX 2004 or Macromedia Flash MX Professional 2004 and create a new Flash document.
- Access Publish Settings (File > Publish Settings), select the Formats tab, and uncheck the HTML option. Select the Flash tab, change the Version drop-down list to Flash Player 6, and click OK. (You can leave ActionScript 2.0 selected.)
-
Place the following code into the first frame of this movie (there's no semicolon at the end):
#include "app.as" - From the Components panel, drag a TextArea component to the Stage. Use the Free Transform tool to resize the TextArea. With the TextArea still selected, use the Properties panel to give the component an instance name ta. Save this file as app.fla.
- Create a new ActionScript file using Flash MX Professional 2004 (or just Notepad or a similar text editor). Save the file as app.as, adjacent to app.fla.
-
Type the following code:
onActivate = function(shell, appID, shellID, baseTabIndex, appData) { gShell=shell; var myString=""; myString += "shell=" + shell +newline; myString += "id=" + appID +newline; myString += "shellID=" + shellID +newline; myString += "baseTabIndex=" + baseTabIndex +newline; myString += "appData=" + appData; ta.text = myString; } Central.initApplication(this, this);All you really need to turn a Flash app into a Central app is the
initApplication()method. The first parameter(this)refers to what movie is getting initialized and the second parameter(this)refers to where theonActivate()method (and other handlers) can be found. When Central has fully loaded your application it attempts to trigger theonActivate()method in your movie. Provided you write anonActivate()method it's where you can begin to perform Central features. This example just takes the parameters received and puts them in thetaTextArea instance.Invariably, the one thing you'll always do is save into a variable that first parameter. Even though the example above doesn't use
gShell, it's a reference to the window managing your app and your key to triggering any methods in the Shell object. (That is, you can usegShell.isConnected()to determine the user's connection status.) The first parameter in anyonActivate()method gives applications, pods, and agents a reference to their appropriate host (the shell, Console, or—in the case of agents—the Agent Manager). - Save app.as, return to app.fla, and publish app.swf (press Shift-F12).
-
Place app.swf along with the downloaded files product.xml and installer.swf in a test folder on your server. For example, with the default ColdFusion MX installation I use the following folder:
C:\CFusionMX\wwwroot\myFirstCentral\ -
Run installer.swf (not by double-clicking it) from a web browser pointing to the server—in my case:
http://127.0.0.1:8500/myFirstCentral/installer.swfThe ":8500" is there because I have ColdFusion listening to port 8500.
- Click Install Now. If you don't have Central installed, it'll be installed automatically.
Note: If you have problems with this portion, you can find the completed files in the folder "part1_finished—Creating a Simple Central Application."
This application doesn't do much more than show that it's working (see
Figure 2). The five arguments received include handles on the application
itself and initial values such as the starting tab index. For now, just
realize that any Flash application can become a Central application by
just adding the initApplication() trigger.
Figure 2. Although it's not much to look at, the application is now running inside Central.
Updating Your Central Application
Whether you add features or fix bugs, you'll want to test the results inside Central. However, you don't have to uninstall and reinstall your application every time you make a change. Instead, you can "update" the version number of your application (which notifies users that a newer version is available for installation) or "overwrite" it, which means just manually writing over the cached files in your Central directory.
I cover overwriting later because it's more of a production tip. In addition, overwriting only works when the list of product files doesn't change. Below I show you how to add a pod to your product. To install the new files, just change the version number in product.xml.
-
Create a new file, just as you did in the previous section (publish settings to Flash Player 6, uncheck the HTML format, and add a TextArea instance named ta). In this case, use the following code:
#include "pod.as" - Change the document properties (press Ctrl-J) to 170 x 160 pixels.
- Save this file as pod.fla.
- Create a new ActionScript file with Flash MX Professional 2004 and save the file as pod.as, adjacent to pod.fla.
-
Type the following code:
onActivate = function(console, podID, viewerID, position, baseTabIndex, data) { gShell=shell; var myString=""; myString += "console=" + console +newline; myString += "podID=" + podID +newline; myString += "viewerID=" + viewerID +newline; myString += "position=" + position +newline; myString += "baseTabIndex=" + baseTabIndex +newline; myString += "appData=" + appData; ta.text = myString; } Central.initPod(this, this);This code should look familiar. The only difference from the app.as file you created earlier is that you initialize with
initPod(), notinitApplication(), and the parameters received includeposition, an integer that matches the slot into which your pod appears. All new pods appear in the zero slot (the uppermost position) but get pushed down as newer ones appear or as the user rearranges them.You're still saving a reference to the window that holds this application—although in this case, it's the Console that hosts the pod, not the shell hosting an application. It's still the first parameter received, however. I use
gShellagain just as a matter of convention. Later in the application you can usegShellto access anything in the Console object (say,gShell.loadApplication()to launch the application portion of this product). - Save pod.as, return to pod.fla, and publish pod.swf (press Shift-F12).
-
Open product.xml to add the pod and increment the version number. Specifically, change this line:
version="1.0"so it reads:
version="1.1"Also change this line:
<!--<pod name="Sample Pod" src="pod.swf" height="160"/>-->so it reads:
<pod name="Sample Pod" src="pod.swf" height="160"/> - Save product.xml.
- Place pod.swf adjacent to product.xml and the rest of your product files—that is, the same location from which you installed the application earlier.
- Quit and relaunch Central and open the application. Select Check for Update from the My First App menu and click OK in the dialog box that appears (shown in Figure 3). When complete, choose View > Console and select My First App from the Pods menu in the Console to see your new pod.
Figure 3. After checking for updates, Central gives you the opportunity to upgrade the application.
Note: If you have problems with this portion, the completed files are in the folder "part2_finished--Updating Your Central Application."
Making a pod is not much different than making a regular application. Naturally, it's a smaller version of it. Any single application can have several pods. (Additional pods appear in a secondary drop-down list within the pod because your application only appears once in the Console.)
In addition to showing the similarities between pods and applications, this exercise demonstrates how easily you can update your application. There is no need to reinstall it; you just update it. As you work you may not even want to go through this simple process for every little change. In that case, you can just change the publish destination in Flash (see Figure 4) so that exported SWFs overwrite the files in Central's cache. This works only for files that are already present. In the exercise above you adjusted product.xml to include the pod. Now that the pod is part of your installed application you can update the pod by simply overwriting it. Naturally, you have to close and reopen your application or pod to see the changes appear.
Figure 4. By changing the target publish folder in Flash you can update your application files while testing. Just point to the cache folder in Central.
Incidentally, you can overwrite agents too. However, because agents won't stop running when you switch applications, you need to restart Central for your changes to the agent to become noticeable. I cover agents next.
Creating an Agent
Your Central product can include several applications. (You might call the product a "suite" in that case.) For each application you can have multiple pods; in fact, after users install the application you can add the pods dynamically—without their intervention. Besides pods, your application can include up to one agent.
An agent is a SWF that's never seen. However, you can set your agent to start every time that Central does. This means code continues executing even when your application is closed and Central is minimized. Agents are useful for performing background tasks such as checking current weather conditions. When the temperature drops, for example, you could inform the user through a notice that behaves almost like an instant message. Not only are agents good for behind-the-scenes work but they're the logical place to store code that's common to your application and pods. This way it's available anytime the application needs it.
Sometimes commands are only available to pods, such as loadApplication().
Other times only applications can trigger them, such as requestPayment().
Generally, the agent—and its "shell" the Agent Manager—is the common
denominator: It runs constantly and most commands are available there.
The ways that your application, pods, and agent talk to Central is through
their respective managing objects: Shell, Console, and Agent Manager.
You can see in Table 1 that most of the methods are available for all
three objects. That is, you can put code where you want. However, some
methods don't apply to certain situations. For example, a pod doesn't
need to use isConsoleOpen() to find out whether the Console
is open because the Console must be open in the first place for the pod
to find out. There are other logical restrictions where one object doesn't
support a particular method, but methods are available where you need
them. For the most part it's up to you whether you trigger a method from
your application, agent, or pod(s).
| Methods | Agent Manager | Shell | Pod |
|---|---|---|---|
| Notices | |||
| addNotice | ![]() |
![]() |
![]() |
| getNotices | ![]() |
![]() |
![]() |
| removeNotice | ![]() |
![]() |
![]() |
| Local Internet Cache | |||
| addToLocalInternetCache | ![]() |
![]() |
![]() |
| inLocalInternetCache | ![]() |
![]() |
![]() |
| removeFromInternetCache | ![]() |
![]() |
![]() |
| Information | |||
| isConsoleOpen | ![]() |
![]() |
![]() |
| isConnected | ![]() |
![]() |
![]() |
| getPreferences | ![]() |
![]() |
![]() |
| getHeight | ![]() |
![]() |
![]() |
| getLastTabIndex | ![]() |
![]() |
![]() |
| Pod Management | |||
| getPods | ![]() |
![]() |
![]() |
| addPod | ![]() |
![]() |
![]() |
| viewPod | ![]() |
![]() |
![]() |
| removePod | ![]() |
![]() |
![]() |
| getViewedPods | ![]() |
![]() |
![]() |
| Application Management | |||
| getViewedApplications | ![]() |
![]() |
![]() |
| loadApplication | ![]() |
![]() |
![]() |
| Agent Management | |||
| startAgent | ![]() |
![]() |
![]() |
| stopAgent | ![]() |
![]() |
![]() |
| getAgent | ![]() |
![]() |
![]() |
| Miscellaneous | |||
| editLocationDialog | ![]() |
![]() |
![]() |
| newLocationDialog | ![]() |
![]() |
![]() |
| requestSizeChange | ![]() |
![]() |
![]() |
| validateActivationKey | ![]() |
![]() |
![]() |
| requestPayment | ![]() |
![]() |
![]() |
| getBounds | ![]() |
![]() |
![]() |
| getSelectedItem | ![]() |
![]() |
![]() |
| setProgress | ![]() |
![]() |
![]() |
| setStatus | ![]() |
![]() |
![]() |
| isPurchased | ![]() |
![]() |
![]() |
While it's impossible to put all your code in the agent, you should definitely try to keep most common elements here. Ultimately, you need to send messages among your agent, pod, and application. The channel over which the pieces communicate is the Local Connection object. You can use the existing version in Macromedia Flash, but Macromedia Central has a much more eloquent version called LCService. This class not only simplifies managing multiple connections (say, many pods and application instances) but, because it's synchronous, you can set up methods that return values. I use it next to let your application and pods trigger code in the agent, as well as let the agent trigger code in the application and pods.
Note: Just in case you're thinking of using local shared objects to make the different pieces of your product communicate with each other, don't. You'll run into problems if two files attempt to read and write at the same time. Besides, the LCService class makes this task very easy. For more information about LCService, read Ethan Malasky's article, "Understanding and Using the LCService Library."
In the next exercise I show you that adding an agent is nearly the same
as making the application or pod. The key is to select the appropriate
tasks for your agent to perform. Generally speaking, this includes tasks
you want to execute independently of whether the user is actively running
your application or pod. In your agent, for example, you could use setInterval() to
trigger a function that accesses a web service every 10 minutes and finds
out the current temperature in the user's city. Of course, the user would
need to use either a pod or application as an interface to set their
city. Similarly, if the agent reports the results it gathers it needs
to send that information to a pod, application, or—perhaps—a notice.
Agents don't start and stop as your application is opened and closed.
Therefore, carefully deciding what tasks your agent executes (anytime
Central is open) is both an opportunity and a responsibility.
The basic idea behind LCService is that you want "clients" (the pods
and application) to access methods in the "server" (the agent). Conversely,
the agent should have access to methods in the pods and application.
Because it's all handled synchronously, the pods, application, and agent
can trigger—and get values returned—from any method in your product.
You just need to specify which methods to expose to the LCService.
The following steps show you how to define the methods in a file called interface.as:
-
Create a new ActionScript file in Flash MX Professional 2004 or in a text editor. Save the file as interface.as. Insert the following code:
myInterface=new Object(); myInterface.name="myInterfaceName"; myInterface.interfaces=new Object(); myInterface.interfaces.Client=["tellEveryone"]; myInterface.interfaces.Server=["agentMethod", "forwardMethod"];
Here's the simple way to read this code: We're planning to have one method in the application and pods (
tellEveryone) and two methods in the agent (agentMethodandforwardMethod). The LCService class uses a client/server metaphor where the agent is the server and the pods and application are the client. Each file in your product needs the same interface definition—which will be easy to include now that you have a separate file (interface.as). -
Create a new file, as you did in the earlier exercises. This time don't bother with anything on the Stage because the agent is never visible. Just set the publish settings to Flash Player 6 and uncheck the HTML format.
Also, put this code in the first frame:
#include "interface.as"
#include "agent.as" - Save this file as agent.fla.
- Create a new ActionScript file and save it as agent.as, adjacent to agent.fla.
-
Type the following code:
1 owner=this; 2 agentMethod=function(param){ 3 return "I heard "+param; 4 } 5 forwardMethod=function(param){ 6 myService.tellEveryone(param); 7 } 8 onActivate = function(agentManager, agentID, data) { 9 gShell=agentManager; 10 myService=Central.LCService.createServer(myInterface, owner, true); 11} 12 Central.initAgent (this, this);The
onActivate()andinitAgent()methods should look familiar. The main thing inonActivate()is creating a server instance of the LCService class. ThemyServicevariable is the way the agent triggers code in the pod or application (as on line 6). ThecreateServer()method specifies themyInterfacevariable (defined in the interface.as file) and passes a reference to the place where server methods will be found (this timeline) and opt for the synchronous behavior (in the true parameter).Also, recall from interface.as that the two methods (
agentMethodandforwardMethod) are exposed to the clients—that is, the pod and application. Just as how line 6 accesses thetellEveryone()method (to be defined in the application and pod) using a reference to the LCService, the pod and application similarly accessagentMethod()andforwardMethod(). - Save agent.as, return to agent.fla, and publish agent.swf (press Shift-F12).
-
Open product.xml in order to add the pod and increment the version number. Specifically, change this line:
version="1.1"so it reads:
version="1.2"Also change this line:
<!--<agent name="Sample Agent" src="agent.swf" started="true"/>-->so it reads:
<agent name="Sample Agent" src="agent.swf" started="true"/> - Save product.xml.
Notice that the started attribute means that this agent launches as
soon as Central does. (Otherwise you have to start it with the startAgent() command.)
Before you actually update the application, first update the pod and application files so that they use the agent:
-
Open pod.as and replace all the code with the following:
owner=this; tellEveryone=function(param){ ta.text+=param+newline; } onActivate = function(console, podID, viewerID, position, baseTabIndex, data) { gShell=console; var uniqueID = podID+"_"+viewerID; myService=Central.LCService.createClient(myInterface, uniqueID, owner, true); } Central.initPod(this, this);In this case we're creating a client version of the LCService class, saved in the
myServicevariable. Like thecreateServer()method,createClient()needs the variable containing the interface (myInterface—which gets defined ininterface.as) and object where the methods will reside (owner, that is this timeline) and whether you want it to behave synchronously (true). The second parameter sent (uniqueID), however, is a unique string to prevent clients from conflicting. It’s not needed withcreateServer()because there can be only one "server."The
tellEveryone()function is simply the pod's implementation of this method. That is, the application has the same method but it executes different code. Finally, although the application triggers the agent'sforwardMethod(), coming up in Step 4 below, nowhere does the pod itself access either of the two agent's methods. -
Save pod.as and open pod.fla. Edit the script to read as follows:
#include "interface.as"
#include "pod.as" - Export it to create pod.swf.
-
Open app.as and change the code to read as follows:
owner=this; tellEveryone=function(param){ ta.text+=param+newline; gShell.setStatus(param); } echo_btn.onPress=function(){ ta.text+=myService.agentMethod(input_txt.text); } send_btn.onPress=function(){ myService.forwardMethod(input_txt.text); } onActivate = function(shell, appID, shellID, baseTabIndex, data) { gShell=shell; var uniqueID = appID+"_"+shellID; myService=Central.LCService.createClient(myInterface, uniqueID, owner, true); } Central.initApplication(this, this);This is just a bit more than the pod's code. Notice that the implementation of
tellEveryoneis slightly different than the pod's version. (Here you change the text in the shell's status bar.) There are also two button instances in the movie (echo_btnandsend_btn) plus a text field instance (input_txt). The echo button just proves that you can call a method in the agent and get a return value. The send button is a bit simpler: It just passes data to the agent, although the agent turns around and sends that data back through thetellEveryonemethod. (In the last part of this tutorial you modify the agent'sforwardMethodso that it looks up the current temperature for a ZIP code that you send it using this button.) -
Return to app.fla and modify the code to read as follows:
#include "interface.as"
#include "app.as" - Before you publish, place two buttons on the Stage (instance names echo_btn and send_btn) and one input text field (named input_txt). Then publish it to create app.swf.
-
Test it out! Launch the application, check for updates, and install the new version. Be sure the pod is open and try typing into the input text field and clicking either button. The
send_btnpasses the string to the agent, which then sends it back to both the pod and application (with the application also changing the status text area). Theecho_btnsimply gets a value back from the agent and places it into the TextArea component.Note: If you have problems with this portion, the completed files are in the folder "part3_finished--Creating an Agent.".
Turning a Simple Application into Something Useful
Although the product you've developed so far is nothing more than an
exercise, it's easy enough to modify so it does something more useful.
Specifically, you can make the agent treat the value received in its forwardMethod as
a ZIP code and look up the temperature using a web service. Without detailing
everything about Central's support for SOAP, simply modify agent.as to
read as follows:
owner=this;
agentMethod=function(param){
return "I heard "+param;
}
forwardMethod=function(param){
clearInterval(weatherInterval);
zipCode=param;
myService.tellEveryone("getting temperature for "+param);
getTempFunction();
}
getTempFunction =function(){
clearInterval(weatherInterval);
myRequest=myWebServiceObject.getTemp(zipCode);
myRequest.onResult=function(theResult) {
myService.tellEveryone(theResult);
weatherInterval=setInterval(getTempFunction,5000)
}
myRequest.onFault=function(theFault) {
tellEveryone("error "+theFault.faultstring);
}
}
onActivate = function(agentManager, agentID, data) {
gShell=agentManager;
myService=Central.LCService.createServer(myInterface, owner, true);
myWSDLUri=
"http://www.xmethods.net/sd/2001/TemperatureService.wsdl";
myWebServiceObject = new WebService(myWSDLUri);
}
onDeactivate = function(){
clearInterval(weatherInterval);
}
Central.initAgent (this, this);
Obviously, there's more code in this example. But the LCService and
two methods exposed to the clients (agentMethod and forwardMethod)
are still there. The forwardMethod is updated to trigger
the custom function getTempFunction(). There, a web service's getTemp() method
is triggered and the two possible result handlers (onResult or onFault)
are defined to pass the data back to the clients (using tellEveryone)
and set up a new interval that repeats the process in five seconds. For
more information about using web services in Macromedia Central, see
the documentation. Notice that because you're using setInterval() there's
a responsibility to use clearInterval() before beginning
an new interval.
In order to see this thing run, launch the application and check for updates. When that's complete, enter a ZIP code in the main application, click the Send button, and then—every five seconds or so—see the current temperature appear in both the pod and application. Actually, you can close the application and still view the pod—even close and reopen the pod! The five-second interval is only for testing purposes. Your real application should be more conservative, perhaps checking the web service only every few minutes.
Note: If you have problems with this portion, the completed files are in the folder "part4_finished--Turning a Simple Application into Something Useful."
Where to Go from Here
This tutorial emphasizes a few habits that you'll learn to appreciate.
One thing you should always do is keep the reference to the appropriate
shell (gShell in all my examples). It's your key to the
entire API for either the shell, Console, or Agent Manager. That is,
you can talk to Central through either of them.
When Central wants to talk to your application—say, to tell you that
the user is resizing the window—it looks for specific event handler functions
defined right in your main movie. That is, onActivate() is
how Central tells your application, pod, or agent that it's fully loaded.
When you study the API for the Application, Pod, or Agent objects, realize
that these are methods you put into your main movie with the expectation
that, at the right time, Central triggers them. You can certainly call
any of these functions yourself—it's a good way to consolidate code—but
for me it was easiest to learn the API once I broke down the six main
objects in this way (application, pod, and agent are managed by the shell,
Console, and Agent Manager).
Although I explained the LCService earlier in the "Creating an Agent" section, it may take you a little while to appreciate it fully. Basically, it consolidates code in the agent as well as lets the agent trigger code in the pods and application (or lets the pods and application trigger code in the agent).
There are many more cool features inside Macromedia Central. Let me give you a preview of my favorites:
- LCDataProvider is a way to declare a data provider
in one place and then access and modify the data in any piece of your
product. When the data changes, every file using the data (and any
component displaying the data) reflects the change immediately. A data
provider is basically an array full of identically formatted ActionScript
objects (such as records in a database where each one has fields for
first name, last name, and number). Many Flash components can subscribe
to a data provider to keep themselves in perfect sync. (If you want
to use traditional data providers with the Central component, be sure
to instantiate them using new
Central.DataProviderClass(). - Local Internet Cache is adjacent to Central where you can force any data file to cache. This way, users can still view images (including progressive JPEGs and GIFs) later. This also includes query results—say, the results of an ASP request. There are extensive tools to check whether a file exists already, remove it, or overwrite it. By default the cache size is 20 MB but users are automatically prompted to increase this when they exceed that amount.
- Notices are almost like little e-mail messages that appear in a common place on the Console. Users can set these so they chime when they arrive. Hopefully, developers won't send so many notices that they become spam, but they can be quite useful. For example, in my real estate application, users specify the sort of house they're looking for. Using an agent, Central periodically checks for new houses that match their profile. When one is available a notice pops up. Developers can control how long a notice stays up and also write scripts that react to users interacting with the notice.
- Blasting is a way for one application to prepare data (usually based on what the user selects) and send it to another application, which then processes the data in its own way. This means there's a sending application and a receiving application. One application might gather stock prices, for example, and then blast those numbers to a graphing tool. This cooperative nature means your application can focus on being really good at one thing instead of trying to be an "everything app."
Setting up the sending application is different than setting up the
receiving application. In either case, for two applications to pass data
they need to agree on a common data type. The sending application prepares
the data to send (by creating a SelectedItem object) and
then sets a "selection" (using setSelection()). It's not
until the user selects "Blast!" (from the highlighted Blast menu appearing
at the bottom right of the shell) that the data is sent. The sending
application just prepares the data and makes it available to blast. (The
exception to this is when user have autoblast turned on, in which case
data is sent as soon as a selection is set.)
The receiving application, in order to receive the data, first has to
declare that it accepts the same data type being sent. It also defines
an onSelectedItem() handler. This is the method that Central
calls when data is sent.
Although your first Central application will probably fail to earn you a million dollars, you should now have a good handle on the main pieces of a Central application. Specifically, you learned the following:
- How product.xml identifies which files get installed and easily updates existing installed components
- How to initialize an application (and pod and agent)
- How the
onActivate()callback is where you can begin doing Central stuff, as well as where you get a reference to the appropriate shell—Shell, Console, or Agent Manager, depending on whether you're in the application, pod, or agent file, respectively - How the LCService class simplifies sending messages between your application pieces
- How to set the publish directory in Flash to target the cache in Central, among other tips

